package org.fight.landowner.remoting.protocol;

/**
 * @Author wangxuehao02
 * @Date 2024/2/4 8:44 PM
 * @Description
 * 远程指令类型
 **/
public enum RemotingCommandType {
    REQUEST((byte) 0),
    RESPONSE((byte) 1);

    private final byte code;

    RemotingCommandType(byte code) {
        this.code = code;
    }

    public byte getCode() {
        return code;
    }

    public static RemotingCommandType getByCode(byte code) {
        switch (code) {
            case 0: {
                return REQUEST;
            }
            case 1: {
                return RESPONSE;
            }
            default: {
                return null;
            }
        }
    }
}
